#!/data/Software/mydan/perl/bin/perl -I/data/Software/mydan/Connector/lib -I/data/Software/mydan/Connector/private/lib
use strict;
use warnings;
use JSON;
use LWP::UserAgent;

my ( $ssologoutapi, $ssologoutaddr );
BEGIN{
    use Configini;
    $ssologoutapi = Configini::get( 'ssologoutapi' );
    $ssologoutaddr = Configini::get( 'ssologoutaddr' );
    die "ssologoutapi or ssologoutaddr undef on config.ini" unless $ssologoutapi || $ssologoutaddr;
};

$| ++;

=head1 SYNOPSIS

    cookie => 'MTUxNTAzMzg1NnxEdi1CQkFFQ180SUFBUXdCRUFBQU5mLUNBQUVGZEc5clpXNEdjM1J5YVc1bkRDSUFJREk0T1Rsa1l6aG1ZMk5tWWpRMk16TmtaV1kzTlRSbE1XWmtNVFpsTW1JeHyVJcLDk8iEGWlwsv8le0WzgNxhZ6JIYRFMOYzE8fKecA==',

=cut

return sub
{
    my %param = @_;
    return $ssologoutaddr if $ssologoutaddr;

    my $ua = LWP::UserAgent->new;
    my $res = $ua->get( "$ssologoutapi$param{cookie}" );
    return if $res->is_success;
    die "logout fail";
}

